package org.example.controller;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.example.annotation.RateLimit;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class TestController {
    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Resource
    private RedisTemplate<String,String> redisTemplate;

    @GetMapping("/index")
    //@RateLimit(permitsPerSecond = 0.1, message = "接口请求过快，请稍后重试")
    public String index(){
        String str = "";
        redisTemplate.opsForValue().set("test", "aaa");
        return "index";
    }
}
